<?php 
include ("../includes/config_conexao.php");

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: Help Desk - SISAT <diogo@diogovm.com>' . "\r\n";
//$headers .= 'Cc: diogo@diogovm.com' . "\r\n";

if(!empty($idServico)){
	$resEmail = mysql_query("select c.email_cliente, u.email_usuario
							from servico s
							inner join cliente c on s.id_cliente = c.id_cliente
							left join usuario u on s.id_usuario = u.id_usuario
							where s.id_servico = {$idServico}");
	if(mysql_num_rows($resEmail) == 1 ) {
		while ($ln = mysql_fetch_array($resEmail)){
			mail($ln['email_cliente'].",".$ln['email_usuario'], $subject, $message, $headers);	
		}
	}
}
?>